package reset

import (
	"encoding/json"
	"sensitives/service/dic"
	"strconv"

	"github.com/gin-gonic/gin"
)

func Reload(cx *gin.Context) {
	siteid, err := strconv.Atoi(cx.Param("siteid"))
	type response struct {
		Code bool
		Data interface{}
	}
	var res response
	if err != nil || siteid == 0 {
		res.Code = false
		res.Data = "失败"
		data, _ := json.Marshal(res)
		cx.Writer.Write(data)
		return
	}
	dic.LoadSiteDic(siteid)
	res.Code = true
	data, _ := json.Marshal(res)
	cx.Writer.Write(data)
}
